<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<link rel="stylesheet" type="text/css" href="/static/component/laytp/module/cityPicker/city-picker.css">

<body id="optPage">
<form class="layui-form layui-form-pane" id="commentForm">
    <div class="page-title"><div class="page-title-con"><span>设置代写费</span><div class="move_title"></div><?php include "../public/sub.php";?></div></div>
    <div class="main-container">

        <div class="block-generic">
            <div class="layui-form-item height_auto">
                <div class="short_table_list" key="1">
                    <div class="opt-btn-group">
                        <div><span>分配信息</span></div>
                    </div>
                    <table class="layui-table" lay-size="sm">
                        <thead>
                        <tr>
                            <th width="45">序号</th>
                            <th>项目名称</th>
                            <th>委托方</th>
                            <th>招标方式</th>
                            <th>投标单位</th>
                            <th>性质</th>
                            <th>标书费用(元)</th>
                        </tr>
                        </thead>
                        <tbody class="short_table_tbody" id="list_list" style="min-height: 400px;"></tbody>
                    </table>
                    <div class="listerror">提示：<span></span></div>
                </div>
            </div>
        </div>

    </div>
</form>
<script>
    var param_ids = getQueryVariable('ids') || '';
    //待处理


    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();

        facade.ajax({type: 'get', url: ask_bid_dai,data:{ids:param_ids}}).done(function(res){
            if (res.code === 2000) {
                var touinfo = res.data.touinfo;


                short_table_opt_func('', 1);


                var list = res.data.touinfo;
                if(list.length > 0){
                    for (var key in list){
                        var str = '';
                        var nums = parseInt(key)+1;
                        str += '<tr>';
                        str += '<td style="width: 45px">'+nums+'</td>';
                        str += '<td><input type="text" class="layui-input bidname disabled" disabled value="'+list[key].bidname+'"></td>';
                        str += '<td><input type="text" class="layui-input weier disabled" disabled value="'+list[key].weier+'"></td>';
                        str += '<td><input type="text" class="layui-input zhaotype_name disabled" disabled value="'+list[key].zhaotype_name+'"></td>';
                        str += '<td><input type="text" class="layui-input touunit disabled" disabled id="'+list[key].id+'" value="'+list[key].touunit+'"></td>';
                        str += '<td><input type="text" class="layui-input touxing_name disabled" disabled value="'+list[key].touxing_name+'"></td>';
                        str += '<td><input type="number" class="layui-input biaofee" value="'+list[key].biaofee+'"></td>';
                        str += '</tr>';
                        $("#list_list").append(str);
                    }
                }
                update_refresh_row_func();




                initParseMoney();
                render_from();
            }
        });

        form.on('submit(add)', function(data){

            var validRes = $("#commentForm").valid();
            if(!validRes){return false;}


            var list = [''];
            try {
                $('#list_list tr').each(function (i) {
                    var id = $(this).find('.touunit').attr('id') || 0;
                    var biaofee = $(this).find('.biaofee').val();

                    list.push({
                        id:id,
                        biaofee:biaofee,
                    });
                });
            } catch(e) {
                $(".listerror").find('span').text(e.message);
                $(".listerror").show();
                return false;
            }
            $(".listerror").hide();
            data.field.list = list;






            data = parseMoney(data);
            data.field.ids = param_ids;
            facade.ajax({url: ask_bid_dai, data:data.field}).done(function(res){
                if (res.code === 2000) {
                    dataPostTimeOut();
                }
            });

            return false;
        });

    });




</script>
</body>
</html>
